<?
//Set 0.0.1
class set{
    private $elements=array();
    private $pointer=0;
    function __construct($elements=""){
        if(is_array($elements)){
            $this->elements=$elements;
        }
        elseif($elements!=""){
            $this->elements=Array($elements);
        }
    }
    //Add the elements
    function add($elements){
        if(is_array($elements)){
            foreach($elements as $v){
                $this->push($v);
            }
        }
        else{
            $this->push($elements);
        }
    }
    //Chek element for exists
    function exists($element){
        foreach($this->elements as $v){
            if($v==$element) return true;
        }
        return false;
    }
    //Push an element
    function push($element){
        if($this->exists($element)) return false;
        array_push($this->elements, $element);
    }
    //Get elements count
    function count(){
        return count($this->elements);
    }
    //Read current element
    function read(){
        if(isset($this->elements[$this->pointer])) return $this->elements[$this->pointer++];
        return false;
    }
    //Set pointer
    function pointer_set($i){
        $this->pointer=$i;
    }
    function pointer_get(){
        return $this->pointer;
    }
    //Get elements
    function get(){
        return $this->elements;
    }
}
?>